table.insert(itemActions,
	function(item, action)
		-- MAGIC/RARE sorceress orbs
		-- see: dir .. "readme.txt" for information regarding these variables
		local priority = 5
		local identify = true
		local dump = true
	
		if not (item.baseItem.baseType.Type == ItemKind.Orb and
				(item.quality==ItemQuality.Magic or item.quality==ItemQuality.Rare)) then
			return false
		elseif action == aPICK and (not item.flags.Identified or isGoodMagicRareOrb(item)) then
			return priority
		elseif action == aIDENT then
			return identify
		elseif action == aSELL and item.flags.Identified and not isGoodMagicRareOrb(item) then
			return true
		elseif action == aDUMP and item.flags.Identified and not isGoodMagicRareOrb(item) then
			return dump
		end

		return false
	end
)

function isGoodMagicRareOrb(item)
	local coldsk, lightsk, firesk, soso = 0, 0, 0, 0
	local blizz, orb, light, fb = 0, 0, 0, 0
	
	for i = 0, item.mods:size() - 1 do
		if (item.mods[i].Stat.Type == StatType.SingleSkill) then
			if item.mods[i].Skill == SkillType.Blizzard then
				blizz=item.mods[i].Value
			elseif item.mods[i].Skill == SkillType.Lightning then 
				light=item.mods[i].Value
			elseif item.mods[i].Skill == SkillType.FireBall then
				fb=item.mods[i].Value
			elseif item.mods[i].Skill == SkillType.FrozenOrb then
				orb=item.mods[i].Value
			end
		elseif item.mods[i].Stat.Type == StatType.ClassSkillsBonus then
			soso=item.mods[i].Value
		elseif item.mods[i].Stat.Type == StatType.SkillTabBonus then
			if item.mods[i].Tab == SkillTab.Fire then
				firesk=item.mods[i].Value
			elseif item.mods[i].Tab == SkillTab.Lightning then
				lightsk=item.mods[i].Value
			elseif item.mods[i].Tab == SkillTab.Cold then
				coldsk=item.mods[i].Value
			end
		end
	end

	return (
			(soso + coldsk + blizz) >=5 or
			(soso + coldsk + orb) >=5 or
			(soso + lightsk + light) >=5 or
			(soso + firesk + fb) >=5
			)
end
